/**
* Copyright (c) By zengqh.
*
* This program is just for fun or demo, in the hope that it  
* will be useful, you can redistribute it and/or modify freely.
*
* Time: 2012/07/12
* File: GLSLEffect.h
* Blog: http://www.cnblogs.com/zengqh/
**/

#ifndef GLSLEffect_h__
#define GLSLEffect_h__

#include "../../Core/Core.h"
#include "../../Core/Declare.h"

#include "../Effect.h"

class GLSLEffect : public Effect
{
public:
	GLSLEffect();
	~GLSLEffect();

public:
	bool load(const char* vs_src, const char* ps_src);
	bool load(const char* file_name);		/* dx effect */

	void active();

public:
	void setFloat(const char* name, f32 v);
	void setInt(const char* name, s32 v);

	void setFloatVector(const char* name, const f32* v, s32 sz);
	void setIntVector(const char* name, const s32* v, s32 sz);

	void setFloatArray(const char* name, const f32* v, s32 sz);
	void setIntArray(const char* name, const s32* v, s32 sz);

	void setMatrix(const char* name, const f32* m);

	/* in dx ?, huuuuuuuuuuu */
	s32  getUniformHandle(const char* name);
	s32  getAttributeHandle(const char* name);


protected:
	GLuint loadShader(GLenum type, const char* shader_src);
	GLuint getVarHandle(const char* name);

protected:
	GLuint		_effect_handle;
};

#endif    /* GLSLEffect_h__ */